package com.frxuexi.mine.repository

import com.frxuexi.lib_base.BaseRepository
import com.frxuexi.lib_base.entity.BaseEntity
import com.frxuexi.lib_http.HttpType
import com.frxuexi.lib_http.NetWorkFactory
import com.frxuexi.mine.ApiService
import com.frxuexi.mine.entity.LeaveEntity
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.Query
import javax.inject.Inject

@OptIn
class LeaveRepository @Inject constructor():BaseRepository() {
    val apiService by lazy { NetWorkFactory.factory(HttpType.TOKEN).create(ApiService::class.java) }

    fun addLeave(map: Map<String,Any>):Flow<BaseEntity<Any>>{
        return apiService.addLeave(mapToBody(map))
    }

    fun getLeaves(status:String):Flow<BaseEntity<List<LeaveEntity>>>{
        return apiService.getLeaves(status)
    }

    fun comLeave(map: Map<String, Any>):Flow<BaseEntity<Any>>{
        return apiService.comLeave(mapToBody(map))
    }
}